package com.ysw.http系列.rest_template;

import com.ysw.bean.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: yu_sw
 * @Description: com.ysw.http系列.rest_template
 * @date:2022/5/20 22:17
 */
@RestController
public class TestController {
    @Autowired
    private RestTemplateService restTemplateService;

    @RequestMapping("/testForObject")
    public User testForObject_01(){
       return restTemplateService.testForObjectWithFormData();
    }
    @RequestMapping("/testForObject_02")
    public User testForObject_02(){
        return restTemplateService.testForObject();
    }
    @RequestMapping("/testForEntity")
    public ResponseEntity testForEntity(){
        return restTemplateService.testForEntity();
    }

    @RequestMapping("/testPostForObject")
    public User testPostForObject(){
        return restTemplateService.testPostForObject_formData();
    }
    @RequestMapping("/testPostForObject_1")
    public User testPostForObject_1(){
        return restTemplateService.testPostForObject_url();
    }
    @RequestMapping("/testPostForObject_2")
    public User testPostForObject_2(){
        return restTemplateService.testPostForObject_requestBody();
    }
}
